<?php
    header('Access-Control-Allow-Origin: *');
    header('Content-Type:text/html;charset=utf-8');
    $con = mysqli_connect("localhost", "root", "root", "mydb");
    $uname = $_POST['uname'];
    $pwd = $_POST['pwd'];
    $status = $_POST['status'];
    if($status == 'student'){
        $sql = "SELECT * FROM stu_info WHERE stu_id = '$uname' and stu_pwd = '$pwd';";
    }else{
        $sql = "SELECT * FROM tch_info WHERE t_id = '$uname' and t_pwd = '$pwd';";
    }
    $res = mysqli_query($con,$sql);
    if(mysqli_fetch_row($res) != 0){
        echo 'ok';
    }else{
        echo 'no';
    }
    mysqli_close($con);
?>